/**
 * ...
 * @author Default
 * @version 0.1
 */

package com.crlclr.ui {
	import com.crl.ui.controls.Component;
	import com.crlclr.events.*;
	import com.crlclr.managers.QTextFormat;
	
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	
	public class ThumbLabel extends Component {
		private var defaultColor:Number = 0xFF99CC;
		private var selectedColor:Number = 0x999999;
		private var selectColor:Number = 0xFF9C00;
		
		private var textFiled:TextField;
		
		public function ThumbLabel() {
			
			super();
		}
		
		
		
		override protected function defaults() : void{
			_height=16;
		}
		
		protected override function create():void {
			
			textFiled = new TextField();
			textFiled.mouseEnabled=false;
			textFiled.autoSize=TextFieldAutoSize.LEFT;
			textFiled.y = -2;
			textFiled.defaultTextFormat=QTextFormat.whiteTextFormat;
			var g:Graphics = this.graphics;
			g.beginFill(defaultColor,.5);
			g.drawRect(0, 0, textFiled.textWidth+4, _height);
			addChild(textFiled);
		}
		
		public function set text(value:String):void {
			textFiled.text = value;
			
			var w:int=textFiled.textWidth;
			_width=textFiled.textWidth+4;
		}
		
		public function select():void {
			var g:Graphics = this.graphics;
			g.clear();
			g.beginFill(selectColor);
			g.drawRect(0, 0, _width, _height);
			g.endFill();
		}
		
		public function unselect():void {
			var g:Graphics = this.graphics;
			g.clear();
			g.beginFill(selectedColor);
			g.drawRect(0, 0, _width, _height);
			g.endFill();
		}
	}
	
}
